package org.tity.sql.code.modules.testnewstity.controller;

import org.tity.backends.system.data.controller.ListDataController;
import org.tity.sql.code.entity.test.TestNewsTity;
import org.tity.sql.code.entity.test.TestNewsTitySet;
import org.tity.sql.code.modules.testnewstity.service.TestNewsTityService;
import org.springframework.web.bind.annotation.RestController;
import org.tity.backends.api.annotations.APISet;
import org.tity.backends.api.annotations.API;
import org.springframework.web.bind.annotation.RequestMapping;
import org.tity.backends.api.annotations.Modifies;
import org.tity.backends.api.annotations.Modify;
import org.tity.backends.api.annotations.Params;
import org.tity.backends.api.annotations.Param;
import org.tity.backends.api.annotations.ReturnDatas;
import org.tity.backends.api.annotations.ReturnData;
import org.tity.backends.api.annotations.ErrorCodes;
import org.tity.backends.api.annotations.ErrorCode;
import org.tity.ends.error.CommonError;
import org.tity.backends.api.annotations.VType;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RequestBody;
import org.tity.ends.transfer.Result;
import org.tity.backends.transfer.Parameter;


/**
 * [ test_news_tity ] 控制器
 * @author 李方捷
 * @date 2020-03-26 14:12:33
 **/
@RestController
@APISet(name="新闻模块")
@RequestMapping(value="/modules/testnewstity")
public class TestNewsTityController extends ListDataController<TestNewsTity,TestNewsTitySet,TestNewsTityService> {

	@API(name="获得test_news_tity表单Meta信息")
	@RequestMapping(value=metaUri)
	@Modifies({
		@Modify(author="李方捷",time="20200326",note="创建")
	})
	@ReturnDatas({
		@ReturnData(key=metaKey,name="Meta数据",note="")
	})
	@ErrorCodes({
	    @ErrorCode(code=CommonError.SUCCESS,detail=CommonError.SUCCESS_TEXT),
	    @ErrorCode(code=CommonError.FALIURE,detail=CommonError.FALIURE_TEXT)
	})
	public @ResponseBody Result getMeta(@RequestBody Parameter ps) {
		return super.getMeta(ps);
	}


	@API(name="获取test_news_tity数据",accType=API.AccessType.PRIVATE)
	@RequestMapping(value=getEntityUri)
	@Modifies({
	    @Modify(author="李方捷",time="20200326",note="创建")
	})
	@Params({
	    @Param(key=TestNewsTity.PARAM_PK_NAMES,name="PKS",vType={VType.REQUIRE}),
	})
	@ReturnDatas({
	            @ReturnData(key=entityKey,name="实体数据",note="")
	})
	@ErrorCodes({
	    @ErrorCode(code=CommonError.SUCCESS,detail=CommonError.SUCCESS_TEXT),
	    @ErrorCode(code=CommonError.FALIURE,detail=CommonError.FALIURE_TEXT)
	})
	public @ResponseBody Result getEntity(@RequestBody Parameter ps) {
	        return super.getEntity(ps);
	}


	@API(name="保存test_news_tity",accType=API.AccessType.PRIVATE)
	@RequestMapping(value=saveEntityUri)
	@Modifies({
	    @Modify(author="李方捷",time="20200326",note="创建")
	})
	@Params({
	    @Param(key=TestNewsTity.PARAM_NAMES,name="-",vType={}),
	})
	@ReturnDatas({
	            @ReturnData(key=entityKey,name="保存后的数据",note="")
	})
	@ErrorCodes({
	    @ErrorCode(code=CommonError.SUCCESS,detail=CommonError.SUCCESS_TEXT),
	    @ErrorCode(code=CommonError.FALIURE,detail=CommonError.FALIURE_TEXT)
	})
	public @ResponseBody Result saveEntity(@RequestBody Parameter ps) {
	        return super.saveEntity(ps);
	}


	@API(name="删除test_news_tity",accType=API.AccessType.PRIVATE)
	@RequestMapping(value=deleteEntityUri)
	@Modifies({
	    @Modify(author="李方捷",time="20200326",note="创建")
	})
	@Params({
	    @Param(key=TestNewsTity.PARAM_PK_NAMES,name="PKS",vType={VType.REQUIRE}),
	})
	@ReturnDatas({
	            @ReturnData(key=entityKey,name="保存后的实体数据",note="")
	})
	@ErrorCodes({
	    @ErrorCode(code=CommonError.SUCCESS,detail=CommonError.SUCCESS_TEXT),
	    @ErrorCode(code=CommonError.FALIURE,detail=CommonError.FALIURE_TEXT)
	})
	public @ResponseBody Result deleteEntity(@RequestBody Parameter ps) {
	        return super.deleteEntity(ps);
	}


	@API(name="获取分页的test_news_tity数据")
	@RequestMapping(value=listPageUri)
	@Modifies({
		@Modify(author="李方捷",time="20200326",note="创建")
	})
	@Params({
		@Param(key=TestNewsTity.PARAM_NAMES,name="实体对应的所有属性,作为查询条件",vType={}),
		@Param(key="pageSize",name="每页行数",vType={}),
		@Param(key="pageIndex",name="页码",vType={}),
	})
	@ReturnDatas({
		@ReturnData(key=listKey,name="分页数据",note=""),
		@ReturnData(key="totalRows",name="总行数",note=""),
		@ReturnData(key="pageSize",name="每页行数",note=""),
		@ReturnData(key="pageIndex",name="当前页码",note=""),
		@ReturnData(key="firstPageIndex",name="第一页页码",note=""),
		@ReturnData(key="lastPageIndex",name="最后一页页码",note=""),
		@ReturnData(key="prevPageIndex",name="上一页页码",note=""),
		@ReturnData(key="nextPageIndex",name="下一页页码",note="")
	})
	@ErrorCodes({
	    @ErrorCode(code=CommonError.SUCCESS,detail=CommonError.SUCCESS_TEXT),
	    @ErrorCode(code=CommonError.FALIURE,detail=CommonError.FALIURE_TEXT)
	})
	public @ResponseBody Result listPage(@RequestBody Parameter ps) {
		return super.listPage(ps);
	}


	@API(name="获取全部的test_news_tity数据")
	@RequestMapping(value=listUri)
	@Modifies({
		@Modify(author="李方捷",time="20200326",note="创建")
	})
	@Params({
		@Param(key=TestNewsTity.PARAM_NAMES,name="实体对应的所有属性,作为查询条件",vType={})
	})
	@ReturnDatas({
		@ReturnData(key=listKey,name="列表数据",note="")
	})
	@ErrorCodes({
	    @ErrorCode(code=CommonError.SUCCESS,detail=CommonError.SUCCESS_TEXT),
	    @ErrorCode(code=CommonError.FALIURE,detail=CommonError.FALIURE_TEXT)
	})
	public @ResponseBody Result list(@RequestBody Parameter ps) {
		return super.list(ps);
	}



}
